package com.isoft.service;

import com.isoft.entity.Device;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;
import java.util.Random;

@Service
public class RandomDeviceDataService {
    public static double generateRandomVoltage() {
        Random random = new Random();
        return 100 + random.nextDouble() * 100;
    }
    // 生成随机设备速度
    public static double generateRandomSpeed() {
        Random random = new Random();
        return 10 + random.nextDouble() * 50;
    }
    public static List<Device> generateRandomDeviceDataList(int count) {
        List<Device> deviceList = new ArrayList<>();

        for (int i = 0; i < count; i++) {
            Device device = new Device();
            device.setVoltage(generateRandomVoltage());
            device.setSpeed(generateRandomSpeed());
            deviceList.add(device);
        }
        return deviceList;

    }

}
